package service.Impl;


import dao.*;
import dao.Impl.*;
import pojo.Tbaseorder;
import pojo.Torderinfo;
import service.TorderService;

import java.util.List;

public class TorderServiceImpl implements TorderService {
    TbaseorderDao tb = new TbaseorderDaoImpl();
    TorderinfoDao ti = new TorderinfoDaoImpl();
    TgoodsDao tg = new TgoodsDaoImpl();

     //生成订单
    @Override
    public int addTbase(Tbaseorder tbaseorder) {
        return tb.add(tbaseorder);
    }

    //生成订单详情并减去相应库存
    @Override
    public void addTbinfo(Torderinfo list) {
            ti.add(list);
            tg.updnum(list.getBuyNum(),list.getGoodsId());


    }

    @Override
    public List<Tbaseorder> todall() {
        return ti.list();
    }


}
